package com.dmz.szsf.tempuri;

import org.apache.axis.AxisFault;
import org.apache.axis.EngineConfiguration;
import org.apache.axis.client.Service;
import org.apache.axis.client.Stub;

import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.Remote;
import java.util.HashSet;
import java.util.Iterator;

/**
 * @author lee
 */
public class WebServiceBankLocator extends Service implements WebServiceBank {

    private String WebServiceBankSoap_address = "http://26.30.67.9:24666/WebServiceBank.asmx";
    private String WebServiceBankSoapWSDDServiceName = "WebServiceBankSoap";
    private HashSet ports = null;

    public WebServiceBankLocator() {
    }

    public WebServiceBankLocator(EngineConfiguration config) {
        super(config);
    }

    public WebServiceBankLocator(String wsdlLoc, QName sName) throws ServiceException {
        super(wsdlLoc, sName);
    }

    public String getWebServiceBankSoapAddress() {
        return this.WebServiceBankSoap_address;
    }

    public String getWebServiceBankSoapWSDDServiceName() {
        return this.WebServiceBankSoapWSDDServiceName;
    }

    public void setWebServiceBankSoapWSDDServiceName(String name) {
        this.WebServiceBankSoapWSDDServiceName = name;
    }

    public WebServiceBankSoap getWebServiceBankSoap() throws ServiceException {
        URL endpoint;
        try {
            endpoint = new URL(this.WebServiceBankSoap_address);
        } catch (MalformedURLException var3) {
            MalformedURLException e = var3;
            throw new ServiceException(e);
        }

        return this.getWebServiceBankSoap(endpoint);
    }

    public WebServiceBankSoap getWebServiceBankSoap(URL portAddress) throws ServiceException {
        try {
            WebServiceBankSoapStub _stub = new WebServiceBankSoapStub(portAddress, this);
            _stub.setPortName(this.getWebServiceBankSoapWSDDServiceName());
            return _stub;
        } catch (AxisFault var3) {
            return null;
        }
    }

    public void setWebServiceBankSoapEndpointAddress(String address) {
        this.WebServiceBankSoap_address = address;
    }

    public Remote getPort(Class serviceEndpointInterface) throws ServiceException {
        try {
            if (WebServiceBankSoap.class.isAssignableFrom(serviceEndpointInterface)) {
                WebServiceBankSoapStub _stub = new WebServiceBankSoapStub(new URL(this.WebServiceBankSoap_address), this);
                _stub.setPortName(this.getWebServiceBankSoapWSDDServiceName());
                return _stub;
            }
        } catch (Throwable var3) {
            Throwable t = var3;
            throw new ServiceException(t);
        }

        throw new ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }

    public Remote getPort(QName portName, Class serviceEndpointInterface) throws ServiceException {
        if (portName == null) {
            return this.getPort(serviceEndpointInterface);
        } else {
            String inputPortName = portName.getLocalPart();
            if ("WebServiceBankSoap".equals(inputPortName)) {
                return this.getWebServiceBankSoap();
            } else {
                Remote _stub = this.getPort(serviceEndpointInterface);
                ((Stub)_stub).setPortName(portName);
                return _stub;
            }
        }
    }

    public QName getServiceName() {
        return new QName("http://tempuri.org/", "WebServiceBank");
    }

    public Iterator getPorts() {
        if (this.ports == null) {
            this.ports = new HashSet();
            this.ports.add(new QName("http://tempuri.org/", "WebServiceBankSoap"));
        }

        return this.ports.iterator();
    }

    public void setEndpointAddress(String portName, String address) throws ServiceException {
        if ("WebServiceBankSoap".equals(portName)) {
            this.setWebServiceBankSoapEndpointAddress(address);
        } else {
            throw new ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
        }
    }

    public void setEndpointAddress(QName portName, String address) throws ServiceException {
        this.setEndpointAddress(portName.getLocalPart(), address);
    }
}
